<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>订单结算 | 美多商城</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../C05-Order/SaveOrder.html" />
    
    
    <link rel="prev" href="../C05-Order/OrderDBModel.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="5.2"
        data-chapter-title="订单结算"
        data-filepath="C05-Order/PlaceOrder.md"
        data-basepath=".."
        data-revision="Sat Aug 11 2018 20:09:13 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        美多商城
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="C01-Prepare/index.html">
            
                
                    <a href="../C01-Prepare/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        项目准备
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="C01-Prepare/BusinessModel.html">
            
                
                    <a href="../C01-Prepare/BusinessModel.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        商业模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="C01-Prepare/DevelopmentProcess.html">
            
                
                    <a href="../C01-Prepare/DevelopmentProcess.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        开发流程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="C01-Prepare/ProductAnalysis.html">
            
                
                    <a href="../C01-Prepare/ProductAnalysis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        需求分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="C01-Prepare/ProjectStructure.html">
            
                
                    <a href="../C01-Prepare/ProjectStructure.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        项目架构
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="C01-Prepare/StartProject.html">
            
                
                    <a href="../C01-Prepare/StartProject.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        创建工程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="C01-Prepare/Config.html">
            
                
                    <a href="../C01-Prepare/Config.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        配置
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="C02-Users/index.html">
            
                
                    <a href="../C02-Users/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        用户部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="C02-Users/UserModel.html">
            
                
                    <a href="../C02-Users/UserModel.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        用户模型类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="C02-Users/RegisterAnalysis.html">
            
                
                    <a href="../C02-Users/RegisterAnalysis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        注册业务接口分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="C02-Users/ImageCode.html">
            
                
                    <a href="../C02-Users/ImageCode.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        图片验证码
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="C02-Users/SMSCode.html">
            
                
                    <a href="../C02-Users/SMSCode.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        短信验证码
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="C02-Users/CORS.html">
            
                
                    <a href="../C02-Users/CORS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        跨域CORS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="C02-Users/CelerySendSMSCode.html">
            
                
                    <a href="../C02-Users/CelerySendSMSCode.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        使用Celery发送短信
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="C02-Users/AccountExistingCheck.html">
            
                
                    <a href="../C02-Users/AccountExistingCheck.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        判断帐号是否存在
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="C02-Users/Register.html">
            
                
                    <a href="../C02-Users/Register.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        注册
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="C02-Users/JWT.html">
            
                
                    <a href="../C02-Users/JWT.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        JWT
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="C02-Users/DRF-JWT.html">
            
                
                    <a href="../C02-Users/DRF-JWT.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        Django REST framework JWT
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="C02-Users/Login.html">
            
                
                    <a href="../C02-Users/Login.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        登录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="C02-Users/QQLogin/index.html">
            
                
                    <a href="../C02-Users/QQLogin/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        QQ登录
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.12.1" data-path="C02-Users/QQLogin/Step1.html">
            
                
                    <a href="../C02-Users/QQLogin/Step1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.1.</b>
                        
                        第一步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12.2" data-path="C02-Users/QQLogin/Step2.html">
            
                
                    <a href="../C02-Users/QQLogin/Step2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.2.</b>
                        
                        第二步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12.3" data-path="C02-Users/QQLogin/Step3.html">
            
                
                    <a href="../C02-Users/QQLogin/Step3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.3.</b>
                        
                        第三步
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="C02-Users/UserInfo.html">
            
                
                    <a href="../C02-Users/UserInfo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.13.</b>
                        
                        用户中心个人信息
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="C02-Users/Email/index.html">
            
                
                    <a href="../C02-Users/Email/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.</b>
                        
                        邮件与验证
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.14.1" data-path="C02-Users/Email/DjangoEmail.html">
            
                
                    <a href="../C02-Users/Email/DjangoEmail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.1.</b>
                        
                        Django发送邮件的方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14.2" data-path="C02-Users/Email/SendEmail.html">
            
                
                    <a href="../C02-Users/Email/SendEmail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.2.</b>
                        
                        保存邮箱并发送验证邮件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14.3" data-path="C02-Users/Email/VerifyEmail.html">
            
                
                    <a href="../C02-Users/Email/VerifyEmail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.3.</b>
                        
                        验证邮箱链接
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="C02-Users/Address/index.html">
            
                
                    <a href="../C02-Users/Address/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.</b>
                        
                        收货地址
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.15.1" data-path="C02-Users/Address/AreaSelect.html">
            
                
                    <a href="../C02-Users/Address/AreaSelect.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.1.</b>
                        
                        省市区地址查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15.2" data-path="C02-Users/Address/Cache.html">
            
                
                    <a href="../C02-Users/Address/Cache.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.2.</b>
                        
                        使用缓存
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15.3" data-path="C02-Users/Address/UserAddressManagement.html">
            
                
                    <a href="../C02-Users/Address/UserAddressManagement.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.3.</b>
                        
                        用户地址管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15.4" data-path="C02-Users/Address/UserAddressCode.html">
            
                
                    <a href="../C02-Users/Address/UserAddressCode.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.4.</b>
                        
                        用户地址代码
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="C03-Goods/index.html">
            
                
                    <a href="../C03-Goods/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        商品部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="C03-Goods/DatabaseDesign.html">
            
                
                    <a href="../C03-Goods/DatabaseDesign.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        数据表设计
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="C03-Goods/FastDFS.html">
            
                
                    <a href="../C03-Goods/FastDFS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        FastDFS分布式文件系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="C03-Goods/Docker/index.html">
            
                
                    <a href="../C03-Goods/Docker/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        Docker使用
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="C03-Goods/Docker/Introduce.html">
            
                
                    <a href="../C03-Goods/Docker/Introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.1.</b>
                        
                        Docker简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="C03-Goods/Docker/InstallAndOperations.html">
            
                
                    <a href="../C03-Goods/Docker/InstallAndOperations.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.2.</b>
                        
                        安装与操作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="C03-Goods/FastDFSDocker.html">
            
                
                    <a href="../C03-Goods/FastDFSDocker.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        使用Docker安装FastDFS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="C03-Goods/FastDFSClientAndDjangoFileSystem.html">
            
                
                    <a href="../C03-Goods/FastDFSClientAndDjangoFileSystem.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        FastDFS客户端与自定义文件存储系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="C03-Goods/CKEditor.html">
            
                
                    <a href="../C03-Goods/CKEditor.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        CKEditor富文本编辑器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="C03-Goods/ImportGoodsData.html">
            
                
                    <a href="../C03-Goods/ImportGoodsData.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        添加测试数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="C03-Goods/FreezeHTML.html">
            
                
                    <a href="../C03-Goods/FreezeHTML.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        页面静态化
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="C03-Goods/DjangoCrontab.html">
            
                
                    <a href="../C03-Goods/DjangoCrontab.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        定时任务
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="C03-Goods/GenerateIndexHTMLScript.html">
            
                
                    <a href="../C03-Goods/GenerateIndexHTMLScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        静态化首页的手动脚本
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="C03-Goods/GoodsDetail.html">
            
                
                    <a href="../C03-Goods/GoodsDetail.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.11.</b>
                        
                        商品详情页面
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="C03-Goods/UserBrowseHistory.html">
            
                
                    <a href="../C03-Goods/UserBrowseHistory.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.12.</b>
                        
                        用户浏览历史记录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="C03-Goods/GoodsList.html">
            
                
                    <a href="../C03-Goods/GoodsList.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.13.</b>
                        
                        商品列表页
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="C03-Goods/GoodsSearch.html">
            
                
                    <a href="../C03-Goods/GoodsSearch.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.14.</b>
                        
                        商品搜索
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="C04-Cart/index.html">
            
                
                    <a href="../C04-Cart/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        购物车部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="C04-Cart/DataStructureDesign.html">
            
                
                    <a href="../C04-Cart/DataStructureDesign.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        购物车数据存储设计
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="C04-Cart/Add.html">
            
                
                    <a href="../C04-Cart/Add.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        购物车增加
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="C04-Cart/Query.html">
            
                
                    <a href="../C04-Cart/Query.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        购物车查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="C04-Cart/Modify.html">
            
                
                    <a href="../C04-Cart/Modify.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        购物车修改
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="C04-Cart/Delete.html">
            
                
                    <a href="../C04-Cart/Delete.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        购物车删除
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="C04-Cart/SelectAll.html">
            
                
                    <a href="../C04-Cart/SelectAll.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        购物车全选
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="C04-Cart/MergeCart.html">
            
                
                    <a href="../C04-Cart/MergeCart.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        登录合并购物车
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="C05-Order/index.html">
            
                
                    <a href="../C05-Order/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        订单部分
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="C05-Order/OrderDBModel.html">
            
                
                    <a href="../C05-Order/OrderDBModel.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        订单数据库设计
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="5.2" data-path="C05-Order/PlaceOrder.html">
            
                
                    <a href="../C05-Order/PlaceOrder.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        订单结算
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="C05-Order/SaveOrder.html">
            
                
                    <a href="../C05-Order/SaveOrder.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        保存订单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="C05-Order/OrderSuccess.html">
            
                
                    <a href="../C05-Order/OrderSuccess.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        下单成功
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="C06-Pay/index.html">
            
                
                    <a href="../C06-Pay/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        支付宝支付
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="C06-Pay/Alipay.html">
            
                
                    <a href="../C06-Pay/Alipay.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        接入支付宝
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="C06-Pay/Paying.html">
            
                
                    <a href="../C06-Pay/Paying.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        发起支付
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="C06-Pay/PaymentResult.html">
            
                
                    <a href="../C06-Pay/PaymentResult.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        保存支付结果
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="C07-Xadmin.html">
            
                
                    <a href="../C07-Xadmin.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        Xadmin
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="C08-Permission.html">
            
                
                    <a href="../C08-Permission.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        用户权限控制
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >美多商城</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x8BA2;&#x5355;&#x7ED3;&#x7B97;">&#x8BA2;&#x5355;&#x7ED3;&#x7B97;</h1>
<p><img src="../images/&#x8BA2;&#x5355;&#x7ED3;&#x7B97;&#x9875;.png" alt="&#x8BA2;&#x5355;&#x7ED3;&#x7B97;"></p>
<p><strong>&#x8BA2;&#x5355;&#x7ED3;&#x7B97;&#x9875;&#x9762;&#x6240;&#x9700;&#x7684;&#x6570;&#x636E;&#x4ECE;&#x8D2D;&#x7269;&#x8F66;&#x4E2D;&#x52FE;&#x9009;&#x800C;&#x6765;&#x3002;</strong></p>
<h3 id="1--&#x540E;&#x7AEF;&#x63A5;&#x53E3;&#x8BBE;&#x8BA1;">1.  &#x540E;&#x7AEF;&#x63A5;&#x53E3;&#x8BBE;&#x8BA1;</h3>
<p><strong>&#x8BF7;&#x6C42;&#x65B9;&#x5F0F;</strong> &#xFF1A; GET  /orders/settlement/</p>
<p><strong>&#x8BF7;&#x6C42;&#x53C2;&#x6570;</strong>&#xFF1A;  &#x65E0;</p>
<p><strong>&#x8FD4;&#x56DE;&#x6570;&#x636E;</strong>&#xFF1A;  JSON</p>
<table>
<thead>
<tr>
<th>&#x53C2;&#x6570;</th>
<th>&#x7C7B;&#x578B;</th>
<th>&#x662F;&#x5426;&#x5FC5;&#x987B;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>freight</td>
<td>decimal</td>
<td>&#x662F;</td>
<td>&#x8FD0;&#x8D39;</td>
</tr>
<tr>
<td>skus</td>
<td>sku[]</td>
<td>&#x662F;</td>
<td>&#x7ED3;&#x7B97;&#x7684;&#x5546;&#x54C1;&#x5217;&#x8868;</td>
</tr>
<tr>
<td>id</td>
<td>int</td>
<td>&#x662F;</td>
<td>&#x5546;&#x54C1;id</td>
</tr>
<tr>
<td>name</td>
<td>str</td>
<td>&#x662F;</td>
<td>&#x5546;&#x54C1;&#x540D;&#x79F0;</td>
</tr>
<tr>
<td>default_image_url</td>
<td>str</td>
<td>&#x662F;</td>
<td>&#x5546;&#x54C1;&#x9ED8;&#x8BA4;&#x56FE;&#x7247;</td>
</tr>
<tr>
<td>price</td>
<td>decimal</td>
<td>&#x662F;</td>
<td>&#x5546;&#x54C1;&#x5355;&#x4EF7;</td>
</tr>
<tr>
<td>count</td>
<td>int</td>
<td>&#x662F;</td>
<td>&#x5546;&#x54C1;&#x6570;&#x91CF;</td>
</tr>
</tbody>
</table>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;freight&quot;</span>:<span class="hljs-string">&quot;10.00&quot;</span>,
    <span class="hljs-string">&quot;skus&quot;</span>:[
        {
            <span class="hljs-string">&quot;id&quot;</span>:<span class="hljs-number">10</span>,
            <span class="hljs-string">&quot;name&quot;</span>:<span class="hljs-string">&quot;&#x534E;&#x4E3A; HUAWEI P10 Plus 6GB+128GB &#x94BB;&#x96D5;&#x91D1; &#x79FB;&#x52A8;&#x8054;&#x901A;&#x7535;&#x4FE1;4G&#x624B;&#x673A; &#x53CC;&#x5361;&#x53CC;&#x5F85;&quot;</span>,
             <span class="hljs-string">&quot;default_image_url&quot;</span>:<span class="hljs-string">&quot;http://image.meiduo.site:8888/group1/M00/00/02/CtM3BVrRchWAMc8rAARfIK95am88158618&quot;</span>,
            <span class="hljs-string">&quot;price&quot;</span>:<span class="hljs-string">&quot;3788.00&quot;</span>,
            <span class="hljs-string">&quot;count&quot;</span>:<span class="hljs-number">1</span>
        },
        {
            <span class="hljs-string">&quot;id&quot;</span>:<span class="hljs-number">16</span>,
            <span class="hljs-string">&quot;name&quot;</span>:<span class="hljs-string">&quot;&#x534E;&#x4E3A; HUAWEI P10 Plus 6GB+128GB &#x66DC;&#x77F3;&#x9ED1; &#x79FB;&#x52A8;&#x8054;&#x901A;&#x7535;&#x4FE1;4G&#x624B;&#x673A; &#x53CC;&#x5361;&#x53CC;&#x5F85;&quot;</span>,
            <span class="hljs-string">&quot;default_image_url&quot;</span>:<span class="hljs-string">&quot;http://image.meiduo.site:8888/group1/M00/00/02/CtM3BVrRdPeAXNDMAAYJrpessGQ9777651&quot;</span>,
            <span class="hljs-string">&quot;price&quot;</span>:<span class="hljs-string">&quot;3788.00&quot;</span>,
            <span class="hljs-string">&quot;count&quot;</span>:<span class="hljs-number">1</span>
        }
    ]
}
</code></pre>
<h3 id="2--&#x540E;&#x7AEF;&#x5B9E;&#x73B0;">2.  &#x540E;&#x7AEF;&#x5B9E;&#x73B0;</h3>
<p>&#x5728;orders/serialziers.py&#x4E2D;&#x521B;&#x5EFA;&#x5E8F;&#x5217;&#x5316;&#x5668;</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">CartSKUSerializer</span><span class="hljs-params">(serializers.ModelSerializer)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;
    &#x8D2D;&#x7269;&#x8F66;&#x5546;&#x54C1;&#x6570;&#x636E;&#x5E8F;&#x5217;&#x5316;&#x5668;
    &quot;&quot;&quot;</span>
    count = serializers.IntegerField(label=<span class="hljs-string">&apos;&#x6570;&#x91CF;&apos;</span>)

    <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Meta</span>:</span>
        model = SKU
        fields = (<span class="hljs-string">&apos;id&apos;</span>, <span class="hljs-string">&apos;name&apos;</span>, <span class="hljs-string">&apos;default_image_url&apos;</span>, <span class="hljs-string">&apos;price&apos;</span>, <span class="hljs-string">&apos;count&apos;</span>)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OrderSettlementSerializer</span><span class="hljs-params">(serializers.Serializer)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;
    &#x8BA2;&#x5355;&#x7ED3;&#x7B97;&#x6570;&#x636E;&#x5E8F;&#x5217;&#x5316;&#x5668;
    &quot;&quot;&quot;</span>
    freight = serializers.DecimalField(label=<span class="hljs-string">&apos;&#x8FD0;&#x8D39;&apos;</span>, max_digits=<span class="hljs-number">10</span>, decimal_places=<span class="hljs-number">2</span>)
    skus = CartSKUSerializer(many=<span class="hljs-keyword">True</span>)
</code></pre>
<p>&#x5728;orders/views.py&#x4E2D;&#x7F16;&#x5199;&#x89C6;&#x56FE;</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">OrderSettlementView</span><span class="hljs-params">(APIView)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;
    &#x8BA2;&#x5355;&#x7ED3;&#x7B97;
    &quot;&quot;&quot;</span>
    permission_classes = [IsAuthenticated]

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self, request)</span>:</span>
        <span class="hljs-string">&quot;&quot;&quot;
        &#x83B7;&#x53D6;
        &quot;&quot;&quot;</span>
        user = request.user

        <span class="hljs-comment"># &#x4ECE;&#x8D2D;&#x7269;&#x8F66;&#x4E2D;&#x83B7;&#x53D6;&#x7528;&#x6237;&#x52FE;&#x9009;&#x8981;&#x7ED3;&#x7B97;&#x7684;&#x5546;&#x54C1;&#x4FE1;&#x606F;</span>
        redis_conn = get_redis_connection(<span class="hljs-string">&apos;cart&apos;</span>)
        redis_cart = redis_conn.hgetall(<span class="hljs-string">&apos;cart_%s&apos;</span> % user.id)
        cart_selected = redis_conn.smembers(<span class="hljs-string">&apos;cart_selected_%s&apos;</span> % user.id)

        cart = {}
        <span class="hljs-keyword">for</span> sku_id <span class="hljs-keyword">in</span> cart_selected:
            cart[int(sku_id)] = int(redis_cart[sku_id])

        <span class="hljs-comment"># &#x67E5;&#x8BE2;&#x5546;&#x54C1;&#x4FE1;&#x606F;</span>
        skus = SKU.objects.filter(id__in=cart.keys())
        <span class="hljs-keyword">for</span> sku <span class="hljs-keyword">in</span> skus:
            sku.count = cart[sku.id]

        <span class="hljs-comment"># &#x8FD0;&#x8D39;</span>
        freight = Decimal(<span class="hljs-string">&apos;10.00&apos;</span>)

        serializer = OrderSettlementSerializer({<span class="hljs-string">&apos;freight&apos;</span>: freight, <span class="hljs-string">&apos;skus&apos;</span>: skus})
        <span class="hljs-keyword">return</span> Response(serializer.data)
</code></pre>
<h3 id="3-&#x524D;&#x7AEF;&#x5B9E;&#x73B0;">3. &#x524D;&#x7AEF;&#x5B9E;&#x73B0;</h3>
<p>&#x4FEE;&#x6539;place_order.html&#xFF0C;&#x589E;&#x52A0;Vue&#x53D8;&#x91CF;</p>
<pre><code class="lang-python">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html;charset=UTF-8&quot;&gt;
    &lt;title&gt;&#x7F8E;&#x591A;&#x5546;&#x57CE;-&#x63D0;&#x4EA4;&#x8BA2;&#x5355;&lt;/title&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/reset.css&quot;&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/main.css&quot;&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/host.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/vue-2.5.16.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/axios-0.18.0.min.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
        var user_id = sessionStorage.user_id || localStorage.user_id;
        var token = sessionStorage.token || localStorage.token;
        if (!(user_id &amp;&amp; token)) {
            location.href = &apos;/login.html?next=/cart.html&apos;;
        }
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id=&quot;app&quot;&gt;
    &lt;div class=&quot;header_con&quot;&gt;
        &lt;div class=&quot;header&quot;&gt;
            &lt;div class=&quot;welcome fl&quot;&gt;&#x6B22;&#x8FCE;&#x6765;&#x5230;&#x7F8E;&#x591A;&#x5546;&#x57CE;!&lt;/div&gt;
            &lt;div class=&quot;fr&quot;&gt;
                &lt;div class=&quot;login_btn fl&quot;&gt;
                    &#x6B22;&#x8FCE;&#x60A8;&#xFF1A;&lt;em&gt;{{ username }}&lt;/em&gt;
                    &lt;span&gt;|&lt;/span&gt;
                    &lt;a @click=&quot;logout&quot;&gt;&#x9000;&#x51FA;&lt;/a&gt;
                &lt;/div&gt;
                &lt;div class=&quot;user_link fl&quot;&gt;
                    &lt;span&gt;|&lt;/span&gt;
                    &lt;a href=&quot;user_center_info.html&quot;&gt;&#x7528;&#x6237;&#x4E2D;&#x5FC3;&lt;/a&gt;
                    &lt;span&gt;|&lt;/span&gt;
                    &lt;a href=&quot;cart.html&quot;&gt;&#x6211;&#x7684;&#x8D2D;&#x7269;&#x8F66;&lt;/a&gt;
                    &lt;span&gt;|&lt;/span&gt;
                    &lt;a href=&quot;user_center_order.html&quot;&gt;&#x6211;&#x7684;&#x8BA2;&#x5355;&lt;/a&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;        
    &lt;/div&gt;

    &lt;div class=&quot;search_bar clearfix&quot;&gt;
        &lt;a href=&quot;index.html&quot; class=&quot;logo fl&quot;&gt;&lt;img src=&quot;images/logo.png&quot;&gt;&lt;/a&gt;
        &lt;div class=&quot;sub_page_name fl&quot;&gt;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#x63D0;&#x4EA4;&#x8BA2;&#x5355;&lt;/div&gt;
        &lt;form method=&quot;get&quot; action=&quot;/search.html&quot; class=&quot;search_con fr mt40&quot;&gt;
            &lt;input type=&quot;text&quot; class=&quot;input_text fl&quot; name=&quot;q&quot; placeholder=&quot;&#x641C;&#x7D22;&#x5546;&#x54C1;&quot;&gt;
            &lt;input type=&quot;submit&quot; class=&quot;input_btn fr&quot; name=&quot;&quot; value=&quot;&#x641C;&#x7D22;&quot;&gt;
        &lt;/form&gt;
    &lt;/div&gt;

    &lt;h3 class=&quot;common_title&quot;&gt;&#x786E;&#x8BA4;&#x6536;&#x8D27;&#x5730;&#x5740;&lt;/h3&gt;

    &lt;div class=&quot;common_list_con clearfix&quot;&gt;
        &lt;dl&gt;
            &lt;dt&gt;&#x5BC4;&#x9001;&#x5230;&#xFF1A;&lt;/dt&gt;
            &lt;dd v-for=&apos;address in addresses&apos; :class=&quot;[(nowsite==address.id)?&apos;current&apos;:&apos;&apos;]&quot; @click=&quot;nowsite=address.id&quot;&gt;&lt;input type=&quot;radio&quot; name=&quot;get_site&quot; :value=&quot;address.id&quot; v-model=&quot;nowsite&quot;&gt;{{ address.province }} {{address.city}} {{ address.district }} {{ address.place }} &#xFF08;{{ address.receiver }} &#x6536;&#xFF09; {{ address.mobile }}&lt;/dd&gt;
        &lt;/dl&gt;
        &lt;a href=&quot;user_center_site.html&quot; class=&quot;edit_site&quot;&gt;&#x7F16;&#x8F91;&#x6536;&#x8D27;&#x5730;&#x5740;&lt;/a&gt;
    &lt;/div&gt;

    &lt;h3 class=&quot;common_title&quot;&gt;&#x652F;&#x4ED8;&#x65B9;&#x5F0F;&lt;/h3&gt;    
    &lt;div class=&quot;common_list_con clearfix&quot;&gt;
        &lt;div class=&quot;pay_style_con clearfix&quot;&gt;
            &lt;input type=&quot;radio&quot; name=&quot;pay_style&quot; value=&quot;1&quot; v-model=&quot;pay_method&quot;&gt;
            &lt;label class=&quot;cash&quot;&gt;&#x8D27;&#x5230;&#x4ED8;&#x6B3E;&lt;/label&gt;
            &lt;input type=&quot;radio&quot; name=&quot;pay_style&quot; value=&quot;2&quot; v-model=&quot;pay_method&quot;&gt;
            &lt;label class=&quot;zhifubao&quot;&gt;&lt;/label&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;h3 class=&quot;common_title&quot;&gt;&#x5546;&#x54C1;&#x5217;&#x8868;&lt;/h3&gt;

    &lt;div class=&quot;common_list_con clearfix&quot;&gt;
        &lt;ul class=&quot;goods_list_th clearfix&quot;&gt;
            &lt;li class=&quot;col01&quot;&gt;&#x5546;&#x54C1;&#x540D;&#x79F0;&lt;/li&gt;
            &lt;li class=&quot;col03&quot;&gt;&#x5546;&#x54C1;&#x4EF7;&#x683C;&lt;/li&gt;
            &lt;li class=&quot;col04&quot;&gt;&#x6570;&#x91CF;&lt;/li&gt;
            &lt;li class=&quot;col05&quot;&gt;&#x5C0F;&#x8BA1;&lt;/li&gt;        
        &lt;/ul&gt;
        &lt;ul class=&quot;goods_list_td clearfix&quot; v-for=&quot;(sku,index) in skus&quot;&gt;
            &lt;li class=&quot;col01&quot;&gt;{{index+1}}&lt;/li&gt;
            &lt;li class=&quot;col02&quot;&gt;&lt;img :src=&quot;sku.default_image_url&quot;&gt;&lt;/li&gt;
            &lt;li class=&quot;col03&quot;&gt;{{ sku.name }}&lt;/li&gt;
            &lt;li class=&quot;col05&quot;&gt;{{ sku.price }}&#x5143;&lt;/li&gt;
            &lt;li class=&quot;col06&quot;&gt;{{ sku.count }}&lt;/li&gt;
            &lt;li class=&quot;col07&quot;&gt;{{ sku.amount }}&#x5143;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;

    &lt;h3 class=&quot;common_title&quot;&gt;&#x603B;&#x91D1;&#x989D;&#x7ED3;&#x7B97;&lt;/h3&gt;

    &lt;div class=&quot;common_list_con clearfix&quot;&gt;
        &lt;div class=&quot;settle_con&quot;&gt;
            &lt;div class=&quot;total_goods_count&quot;&gt;&#x5171;&lt;em&gt;{{ total_count }}&lt;/em&gt;&#x4EF6;&#x5546;&#x54C1;&#xFF0C;&#x603B;&#x91D1;&#x989D;&lt;b&gt;{{ total_amount }}&#x5143;&lt;/b&gt;&lt;/div&gt;
            &lt;div class=&quot;transit&quot;&gt;&#x8FD0;&#x8D39;&#xFF1A;&lt;b&gt;{{ freight }}&#x5143;&lt;/b&gt;&lt;/div&gt;
            &lt;div class=&quot;total_pay&quot;&gt;&#x5B9E;&#x4ED8;&#x6B3E;&#xFF1A;&lt;b&gt;{{ payment_amount }}&#x5143;&lt;/b&gt;&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class=&quot;order_submit clearfix&quot;&gt;
        &lt;a @click=&quot;on_order_submit&quot; id=&quot;order_btn&quot;&gt;&#x63D0;&#x4EA4;&#x8BA2;&#x5355;&lt;/a&gt;
    &lt;/div&gt;    

    &lt;div class=&quot;footer&quot;&gt;
        &lt;div class=&quot;foot_link&quot;&gt;
            &lt;a href=&quot;#&quot;&gt;&#x5173;&#x4E8E;&#x6211;&#x4EEC;&lt;/a&gt;
            &lt;span&gt;|&lt;/span&gt;
            &lt;a href=&quot;#&quot;&gt;&#x8054;&#x7CFB;&#x6211;&#x4EEC;&lt;/a&gt;
            &lt;span&gt;|&lt;/span&gt;
            &lt;a href=&quot;#&quot;&gt;&#x62DB;&#x8058;&#x4EBA;&#x624D;&lt;/a&gt;
            &lt;span&gt;|&lt;/span&gt;
            &lt;a href=&quot;#&quot;&gt;&#x53CB;&#x60C5;&#x94FE;&#x63A5;&lt;/a&gt;        
        &lt;/div&gt;
        &lt;p&gt;CopyRight &#xA9; 2016 &#x5317;&#x4EAC;&#x7F8E;&#x591A;&#x5546;&#x4E1A;&#x80A1;&#x4EFD;&#x6709;&#x9650;&#x516C;&#x53F8; All Rights Reserved&lt;/p&gt;
        &lt;p&gt;&#x7535;&#x8BDD;&#xFF1A;010-****888    &#x4EAC;ICP&#x5907;*******8&#x53F7;&lt;/p&gt;
    &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class=&quot;popup_con&quot;&gt;
        &lt;div class=&quot;popup&quot;&gt;
            &lt;p&gt;&#x8BA2;&#x5355;&#x63D0;&#x4EA4;&#x6210;&#x529F;&#xFF01;&lt;/p&gt;
        &lt;/div&gt;

        &lt;div class=&quot;mask&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;/js/place_order.js&quot;&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>&#x65B0;&#x5EFA;place_order.js</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> vm = <span class="hljs-keyword">new</span> Vue({
    el: <span class="hljs-string">&apos;#app&apos;</span>,
    data: {
        host,
        username: sessionStorage.username || localStorage.username,
        user_id,
        token,
        skus: [],
        freight: <span class="hljs-number">0</span>, <span class="hljs-comment">// &#x8FD0;&#x8D39;</span>
        total_count: <span class="hljs-number">0</span>,
        total_amount: <span class="hljs-number">0</span>,
        payment_amount: <span class="hljs-number">0</span>,
        order_submitting: <span class="hljs-literal">false</span>, <span class="hljs-comment">// &#x6B63;&#x5728;&#x63D0;&#x4EA4;&#x8BA2;&#x5355;&#x6807;&#x5FD7;</span>
        pay_method: <span class="hljs-number">1</span>, <span class="hljs-comment">// &#x652F;&#x4ED8;&#x65B9;&#x5F0F;,</span>
        nowsite:<span class="hljs-number">0</span>, <span class="hljs-comment">// &#x9ED8;&#x8BA4;&#x5730;&#x5740;</span>
        addresses: []
    },
    mounted: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
        <span class="hljs-comment">// &#x83B7;&#x53D6;&#x5730;&#x5740;&#x4FE1;&#x606F;</span>
        axios.get(<span class="hljs-keyword">this</span>.host + <span class="hljs-string">&apos;/addresses/&apos;</span>, {
                headers: {
                    <span class="hljs-string">&apos;Authorization&apos;</span>: <span class="hljs-string">&apos;JWT &apos;</span> + <span class="hljs-keyword">this</span>.token
                },
                responseType: <span class="hljs-string">&apos;json&apos;</span>
            })
            .then(response =&gt; {
                <span class="hljs-keyword">this</span>.addresses = response.data.addresses;
                <span class="hljs-keyword">this</span>.nowsite = response.data.default_address_id;
            })
            .catch(error =&gt; {
                status = error.response.status;
                <span class="hljs-keyword">if</span> (status == <span class="hljs-number">401</span> || status == <span class="hljs-number">403</span>) {
                    location.href = <span class="hljs-string">&apos;login.html?next=/user_center_site.html&apos;</span>;
                } <span class="hljs-keyword">else</span> {
                    alert(error.response.data.detail);
                }
            })
        <span class="hljs-comment">// &#x83B7;&#x53D6;&#x7ED3;&#x7B97;&#x5546;&#x54C1;&#x4FE1;&#x606F;</span>
        axios.get(<span class="hljs-keyword">this</span>.host+<span class="hljs-string">&apos;/orders/settlement/&apos;</span>, {
                headers: {
                    <span class="hljs-string">&apos;Authorization&apos;</span>: <span class="hljs-string">&apos;JWT &apos;</span> + <span class="hljs-keyword">this</span>.token
                },
                responseType: <span class="hljs-string">&apos;json&apos;</span>
            })
            .then(response =&gt; {
                <span class="hljs-keyword">this</span>.skus = response.data.skus;
                <span class="hljs-keyword">this</span>.freight = response.data.freight;
                <span class="hljs-keyword">this</span>.total_count = <span class="hljs-number">0</span>;
                <span class="hljs-keyword">this</span>.total_amount = <span class="hljs-number">0</span>;
                <span class="hljs-keyword">for</span>(<span class="hljs-keyword">var</span> i=<span class="hljs-number">0</span>; i&lt;<span class="hljs-keyword">this</span>.skus.length; i++){
                    <span class="hljs-keyword">var</span> amount = <span class="hljs-built_in">parseFloat</span>(<span class="hljs-keyword">this</span>.skus[i].price)*<span class="hljs-keyword">this</span>.skus[i].count;
                    <span class="hljs-keyword">this</span>.skus[i].amount = amount.toFixed(<span class="hljs-number">2</span>);
                    <span class="hljs-keyword">this</span>.total_count += <span class="hljs-keyword">this</span>.skus[i].count;
                    <span class="hljs-keyword">this</span>.total_amount += amount;
                }
                <span class="hljs-keyword">this</span>.payment_amount = <span class="hljs-built_in">parseFloat</span>(<span class="hljs-keyword">this</span>.freight) + <span class="hljs-keyword">this</span>.total_amount;
                <span class="hljs-keyword">this</span>.payment_amount = <span class="hljs-keyword">this</span>.payment_amount.toFixed(<span class="hljs-number">2</span>);
                <span class="hljs-keyword">this</span>.total_amount = <span class="hljs-keyword">this</span>.total_amount.toFixed(<span class="hljs-number">2</span>);
            })
            .catch(error =&gt; {
                <span class="hljs-keyword">if</span> (error.response.status == <span class="hljs-number">401</span>){
                    location.href = <span class="hljs-string">&apos;/login.html?next=/cart.html&apos;</span>;
                } <span class="hljs-keyword">else</span>{
                    <span class="hljs-built_in">console</span>.log(error.response.data);
                }
            })
    },
    methods: {
        <span class="hljs-comment">// &#x9000;&#x51FA;</span>
        logout: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            sessionStorage.clear();
            localStorage.clear();
            location.href = <span class="hljs-string">&apos;/login.html&apos;</span>;
        },
        <span class="hljs-comment">// &#x63D0;&#x4EA4;&#x8BA2;&#x5355;</span>
        on_order_submit: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{

        }
    }
});
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../C05-Order/OrderDBModel.html" class="navigation navigation-prev " aria-label="Previous page: 订单数据库设计"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../C05-Order/SaveOrder.html" class="navigation navigation-next " aria-label="Next page: 保存订单"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
